package com.itmk.web.websocket.service.impl;

import com.itmk.web.userInfo.entity.TokenUUID;
import com.itmk.web.websocket.mapper.WsMapper;
import com.itmk.web.websocket.pojo.Message;
import com.itmk.web.websocket.service.WsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;

@Service
public class WsServiceImpl implements WsService {

    @Autowired
    private WsMapper wsMapper;
    @Override
    public boolean addMessage(Message message,String uuid) {

        // 获取当前时间
        Date date = new Date();
        message.setCreateTime(date);
        return wsMapper.addMessage(message,uuid);
    }

    @Override
    public TokenUUID getTokenUUID(String uuid) {
        return wsMapper.getTokenUUID(uuid);
    }

    @Override
    public List<Message> getMessage(String uuid, String touserUuid) {
        return wsMapper.getMessage(uuid,touserUuid);
    }
}
